package com.example.common_base.ac.utils

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.example.common_base.ac.SingleNetworkCallViewModel
import com.example.common_base.ac.api.ApiHelper
import com.example.common_base.ac.data.DatabaseHelper

class ViewModelFactory(private val apiHelper: ApiHelper, private val dbHelper: DatabaseHelper) :
    ViewModelProvider.Factory {

    override fun <T : ViewModel?> create(modelClass: Class<T>): T {
        if (modelClass.isAssignableFrom(SingleNetworkCallViewModel::class.java)) {
            return SingleNetworkCallViewModel(apiHelper) as T
        }

        throw IllegalArgumentException("Unknown class name")
    }

}